package com.xiongwei.builder;

import com.xiongwei.builder.tradition.AbstractHouse;
import com.xiongwei.builder.tradition.CommonHouse;
import com.xiongwei.builder.tradition.HighBuilding;

/**
 * 传统方式
 * 优点：好理解，已操作
 * 缺点：结构过于简单，没有设计缓存层对象，不利于扩展和维护。把产品和创建产品的过程封装在一起，耦合性强
 *
 * 建造者模式，
 * 又称生成器模式，是一种对象构建模式
 * 可以将复杂对象的构造过程抽象出来，抽象过程的不同实现，可以生成不同的对象
 * @author XiongWei
 * @date 2024/1/18
 */
public class Client {

    public static void main(String[] args) {

        AbstractHouse house1 = new CommonHouse();
        AbstractHouse house2 = new HighBuilding();

        house1.build();
        house2.build();

        HouseBuilder commonBuilder = new CommonBuilder();
        HouseDirector houseDirector1 = new HouseDirector(commonBuilder);
        houseDirector1.constructHouse();

        HighingBuilder highingBuilder = new HighingBuilder();
        HouseDirector houseDirector2 = new HouseDirector(highingBuilder);
        houseDirector1.constructHouse();

    }
}
